#include <Flash.h>
#include <SPI.h>
#include <Serial.h>
#include <EEPROM.h>

Flash* nandFlash;

void setup() 
{
  Serial.begin(115200);
  nandFlash = new Flash(true, true);
  delay(3000);
  Serial.println("Starting Test");
  nandFlash->writeBytes((byte*)"Starting Test", 14);
}

void loop()
{
  for (int j = 0; j < 1000; j++)
  {
    for (int i = 0; i < 256; i++)
    {
      Serial.write(i);
      byte b = (byte)i;
      nandFlash->writeBytes(&b,1);
      delay(5);
    }
  }
  Serial.println("Finished Test");
  nandFlash->writeBytes((byte*)"Finished Test", 14);
  while(1);
}
